<script lang="ts" setup>
import { ref } from 'vue';

const msg=ref(false)
const show=()=>{
  msg.value=!msg.value
}
</script>

<template>
  <button @click="show()">切换</button>
  <div class="box" v-show="msg">
    v-show渲染的
  </div>
  <div class="box" v-if="msg">
    v-if渲染的
  </div>
</template>

<style scoped>
.box{
  width: 300px;
  height: 100px;
  background-color: red;
  margin: 10px;
}
</style>
